home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / wbt31b.zip / STONES.WB$ < prev    next >
Text File  |  1991-01-23  |  2KB  |  68 lines

  1. ;Stones game
  2.  
  3. ; RemainingStones is the number of remaining stones. (15 thru 35)
  4. ; MaxTakePerTurn is the most you can take away at one time  (3 thru 6)
  5.  
  6. CR=StrCat(Num2Char(13),Num2Char(10))
  7. TextBox("HOW 2 PLAY STONES","stones.wtx")
  8. ClipPut("")
  9. if WinExist("Clipboard") then WinZoom("Clipboard")
  10. if !WinExist("Clipboard") then RunZoom("clipbrd.exe","")
  11.  
  12.  
  13. :playitagainsam
  14. RemainingStones=Random(21)
  15. ;Normalize RemainingStones to be between 15 and 35
  16. RemainingStones = RemainingStones + 15
  17.  
  18. MaxTakePerTurn=Random(3)
  19. ;Normalize MaxTakePerTurn to be between 3 and 6
  20. MaxTakePerTurn = MaxTakePerTurn + 3
  21. TheMagicNumber = MaxTakePerTurn + 1
  22.  
  23. ClipPut("STONES%CR%")
  24. ClipAppend("Starting with %RemainingStones% Stones.%CR%")
  25.  
  26. :next
  27.  PlayerTakes=AskLine("STONES","%RemainingStones% Stones left. Take 1 to %MaxTakePerTurn% stones","")
  28.  
  29. if PlayerTakes<1 then goto cheat
  30. if PlayerTakes>MaxTakePerTurn then goto cheat
  31. goto gotok
  32.  
  33. :cheat
  34. Message("STONES","You cheat!  You may only take 1 to %MaxTakePerTurn% stones.")
  35. goto next
  36.  
  37. :gotok
  38. ClipAppend("Human takes %PlayerTakes% stones%CR%")
  39. if PlayerTakes>=RemainingStones then goto youlose
  40.  
  41. RemainingStones = RemainingStones - PlayerTakes
  42. if RemainingStones==1 then goto complose
  43.  
  44. MyMove =RemainingStones - 1
  45. MyMove = MyMove mod TheMagicNumber
  46. if MyMove == 0 then MyMove = Random(MaxTakePerTurn)+1
  47. StonesLeft =RemainingStones - MyMove
  48. ClipAppend("Hmm %RemainingStones% stones left. I take %MyMove% stones, leaving %StonesLeft%.%CR%")
  49. RemainingStones = StonesLeft
  50. if RemainingStones==1 then goto youlose
  51. goto next
  52.  
  53. :youlose
  54. ClipAppend("Human stuck with final stone.%CR%")
  55. Message("STONES","Nyah Nyah Nyah.  You Lose.")
  56. goto bye
  57.  
  58. :complose
  59. ClipAppend("Hmmm I lost.  Human must be running program on defective CPU.%CR%")  
  60. Message("STONES","Hmmm.  I lost.  CPU must be damaged. Please replace.")
  61. :bye
  62. Response=AskYesNo("STONES","Would you like to play again?")
  63. if Response == @TRUE then goto playitagainsam
  64. ErrorMode(@off)
  65. if WinExist("Clipboard") then WinClose("Clipboard")
  66. exit
  67.  
  68.